<%-- 
    Document   : form
    Created on : 03/09/2009, 15:08:48
    Author     : leidson
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="javacademic.disciplina.Disciplina" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Javacademic</title>
    </head>
    <% Disciplina p = (Disciplina) request.getAttribute("disciplina"); %>
    <body>
    <h1>Cadastro de Disciplina</h1>
    <br />
    <% if (p == null){ %>
      <form method="post" action="IncluirDisciplinaServlet">
        <% } else { %>
        <form method="post" action="AlterarDisciplinaServlet">
        <% } %>
        <table>
             <% if (p != null) { %>
         <tr>
                    <td>Código:</td>
                    <td><input readonly name="codigo" type ="text" value="<%= p.getCodigo() %>" /></td>
                </tr>
                <% } %>
                   <tr>
                    <td>Disciplina:</td>
                    <td><input name="nome" type ="text" value="<%= ((p != null) ? p.getNome() : "") %>" /></td>
                </tr>
                  <tr>
                    <td>Descrição:</td>
                    <td><input name="descricao" type ="text" value="<%= ((p != null) ? p.getDescricao() : "") %>" /></td>
                </tr>
                <tr>
                    <td>Créditos:</td>
                    <td><input name="creditos" type ="text" value="<%= ((p != null) ? p.getCreditos() : "") %>" /></td>
                </tr>
              </table>
              <table>
                <tr>
                    <td><input type="submit" value="Salvar"/></td>
                    <td><a href="ListarDisciplinaServlet">Cancelar</a></td>
                </tr>
            </table>
        </form>
    </body>
</html>
